import { goTo } from '@/modules/move'

export const enableRoom = (room: MyRoom, pcName: string) => {
    const pc = Game.powerCreeps[pcName]
    if (!pc || !pc.room) return

    // 如果房间控制器还没有启用 power
    if (!room.controller.isPowerEnabled) {
        if (pc.pos.isNearTo(room.controller)) {
            pc.enableRoom(room.controller)
        } else {
            goTo(pc, room.controller.pos)
        }
    }
}
